UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f/cKAnLlNdu8dtWvybzmCKa3R+N3bojoAiVQSXxKg+c=' 
WHERE 
  key_id = '273b04c9dbb0d8c6da59531069de14f39d7ad0b9588279996f4c95d8ec2f3023' 
  AND (
    token = 'f/cKAnLlNdu8dtWvybzmCKa3R+N3bojoAiVQSXxKg+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023