UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKa+kJREWEoCDO00MSI+bw27EVFLRt1jQaMUDAScEKU=' 
WHERE 
  key_id = '6f4d09d87c09db3e87ecb12339e26be82b31161035de2bcb4ffe9821e237f8f2' 
  AND (
    token = 'pKa+kJREWEoCDO00MSI+bw27EVFLRt1jQaMUDAScEKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046