UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zR6tffC6y9QqkqhirQx7tjih4UGzFHdAHUwPoynTysA=' 
WHERE 
  key_id = '1dba1c0808532823454ebbf6b8e0cef4f6f8d8636d3cb217efcd542412f89ee2' 
  AND (
    token = 'zR6tffC6y9QqkqhirQx7tjih4UGzFHdAHUwPoynTysA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043