UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1k/J0hmRxv95j4Q1hK5n3yyQCOK+ftM680+toBcrq18=' 
WHERE 
  key_id = '4c5bc17f69defc993adefb0af52c674213be673aeb43a4075ec59237b75fd9e1' 
  AND (
    token = '1k/J0hmRxv95j4Q1hK5n3yyQCOK+ftM680+toBcrq18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036