UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pK8K6pIzBVRO8NLGL+dqhF6iBowh3bMtk46wzemNKYs=' 
WHERE 
  key_id = '84e6f5011567805e259708bd02e32f686dc4bbfe6d42f34186ba52b26da59eaa' 
  AND (
    token = 'pK8K6pIzBVRO8NLGL+dqhF6iBowh3bMtk46wzemNKYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022