UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h2U5CDXgHKMBWwb7Jy2WpCQTsyeIiJYUhObrSz+0/q4=' 
WHERE 
  key_id = 'c2512c40dbe939c31a1db416183ffb536090f917dc7c106215de565406b0d29d' 
  AND (
    token = 'h2U5CDXgHKMBWwb7Jy2WpCQTsyeIiJYUhObrSz+0/q4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046