UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ulf+tIBlmo89wqHzR7NhGHvAaa6UUAYb0cc+dL4spAQ=' 
WHERE 
  key_id = '4707239f37ee161a5455197525495445b9e086d7556990d46a47e9792635f747' 
  AND (
    token = 'Ulf+tIBlmo89wqHzR7NhGHvAaa6UUAYb0cc+dL4spAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023