UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bzQJ78cEXbY/zMT3VLDLXlPmOCEYSKA2m5xpdLirbSs=' 
WHERE 
  key_id = '1d9a474a19d8a23120495e512daae4e9f8f618255f14b5ddbacfa9b2fc70c18b' 
  AND (
    token = 'bzQJ78cEXbY/zMT3VLDLXlPmOCEYSKA2m5xpdLirbSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043