UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DH+tQ1YW9UFCC+o5cmFQhC6a2+4wuUF1DRiRq2fOmnI=' 
WHERE 
  key_id = 'be5408d1e039cf199c4e61486ea2b81f81457d3fcac8cb140841246042a2c540' 
  AND (
    token = 'DH+tQ1YW9UFCC+o5cmFQhC6a2+4wuUF1DRiRq2fOmnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034