UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrsQ9KHNlwYyHe6M+M859XFAVXAqoWS5GYDoW69Wr0k=' 
WHERE 
  key_id = '0d9b063471ba3877a8e758417c925d8ff7f610b4bde8eba8e6a9efc126521247' 
  AND (
    token = 'yrsQ9KHNlwYyHe6M+M859XFAVXAqoWS5GYDoW69Wr0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035