UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nhy7L2iTnnUeEEObBR/AALexBqtYFxVDfj7ukOTcnSU=' 
WHERE 
  key_id = '6f6fd54cdbf465fc002788ca35fabbe7a7a7f256700f4fae1c153fbe0cadc241' 
  AND (
    token = 'Nhy7L2iTnnUeEEObBR/AALexBqtYFxVDfj7ukOTcnSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023