UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JUhdGxOZFty0DW58xBfCniQ7fB8ROCcTHoHMnSPOnvY=' 
WHERE 
  key_id = '7cf0b3308e54ed3d519d279268820a2790a368bcdcfb882092e939c40d64c10e' 
  AND (
    token = 'JUhdGxOZFty0DW58xBfCniQ7fB8ROCcTHoHMnSPOnvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016