UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ms48waavagGNpGTjHnMHgB4uXT3FUIYSelaULoJ1LW4=' 
WHERE 
  key_id = '59c91866e64153f18271a6b2f595c45a461fcd63aa9d330db2aeec5d33facd81' 
  AND (
    token = 'Ms48waavagGNpGTjHnMHgB4uXT3FUIYSelaULoJ1LW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065