UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dz7GUbkPOCTcf4PN/V78R8ktVx78rn/E8pIdjL9Div4=' 
WHERE 
  key_id = '9e848d68e03974c2e231d12ccd1c86fae338cb8a4656301006e06e0942247fb2' 
  AND (
    token = 'dz7GUbkPOCTcf4PN/V78R8ktVx78rn/E8pIdjL9Div4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044