UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '38VF+gBYyMh3fR2mTw+JPieXImpPrmGzC7WEHBun5dQ=' 
WHERE 
  key_id = '743ec9f08da4163fac93770cde4c07de385b2a2f3d1a0984411ca0516da5750b' 
  AND (
    token = '38VF+gBYyMh3fR2mTw+JPieXImpPrmGzC7WEHBun5dQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031