UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lvZz5uL8PsUndD9DVHSgstQQY+hR/ySvlsFryrnJCx0=' 
WHERE 
  key_id = '2504e74fc51d3e189c89ac17ab4220548753b62bb9baeca827a132d452202691' 
  AND (
    token = 'lvZz5uL8PsUndD9DVHSgstQQY+hR/ySvlsFryrnJCx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020