UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LouG6rZUqzBw6Ez+rMSBu9BQW5VMSLlYF40l3rvFJB4=' 
WHERE 
  key_id = '9fcfeafc739e50693e3611f528595b0e1c6840328a8e6faeefd53b62a5253685' 
  AND (
    token = 'LouG6rZUqzBw6Ez+rMSBu9BQW5VMSLlYF40l3rvFJB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047