UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DevzK74m48Df7Mt1dVs4X3LtKL5o92CoSqdAS1aQK4E=' 
WHERE 
  key_id = '81c742e3e086c486b0f019452f5973c9fcb7e0502297b3fd676c10de708f01ff' 
  AND (
    token = 'DevzK74m48Df7Mt1dVs4X3LtKL5o92CoSqdAS1aQK4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034