UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5dvxmC0VpvooYpUssgWRPeQQLaxo15iIgiS6Dhoja9c=' 
WHERE 
  key_id = 'd48e536766ab856bc13795db84f394a2645e6afe1cca58158cc2e6a904e6e89c' 
  AND (
    token = '5dvxmC0VpvooYpUssgWRPeQQLaxo15iIgiS6Dhoja9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054