UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O2mPJr5d3c1d+lRoMphT08ZvZ6LuXH4QKSssDvJ/yMQ=' 
WHERE 
  key_id = 'bf94223b4d11d306e20051705411ad9a7a731a916878605e7e972bd0cbc7c960' 
  AND (
    token = 'O2mPJr5d3c1d+lRoMphT08ZvZ6LuXH4QKSssDvJ/yMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042