UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cUWp4b67GeR1G3LUh53kVQOKfaHubkQgGScPHpFUUoc=' 
WHERE 
  key_id = '14858bd6c860827da8a020a18b1feb99b0d2dc43665234850d683eeed4c2549a' 
  AND (
    token = 'cUWp4b67GeR1G3LUh53kVQOKfaHubkQgGScPHpFUUoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039