UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U31lmwsT+eBoyEobaUbnbxyW23af9hlRbOSZ+ktYiFs=' 
WHERE 
  key_id = 'fa5b174be6d8fd0b0eb1d50632714d55e4069a67f125cdd7883c900bcf31c0ce' 
  AND (
    token = 'U31lmwsT+eBoyEobaUbnbxyW23af9hlRbOSZ+ktYiFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030