UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kBZDX8IT6eyqxQLsc9+xbX/zFDmoQno7tqYAQeucO7M=' 
WHERE 
  key_id = '5585a415bec58887ef72dbcbcd6b41e9859c5ac65e9fdc21d6279dfa1157b059' 
  AND (
    token = 'kBZDX8IT6eyqxQLsc9+xbX/zFDmoQno7tqYAQeucO7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029