UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U+KobzPg0qqfs41duau+RBpB/tV1XVo+THA9KwetmhY=' 
WHERE 
  key_id = 'e8e353754076f825e67e488f82f3c15bd6ca82fafa3d1af1c086cf493d2cd41b' 
  AND (
    token = 'U+KobzPg0qqfs41duau+RBpB/tV1XVo+THA9KwetmhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048