UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'btdOpCfoAIVXq2Xh54pLbSYShPbzVq6PP7crMEyTkjY=' 
WHERE 
  key_id = '912e41504a90d600fb0d9fc2fbf441b461d26fe286874af64d9466add6f8c3b5' 
  AND (
    token = 'btdOpCfoAIVXq2Xh54pLbSYShPbzVq6PP7crMEyTkjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028