UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NBflY0srSekWox+VvaB/PqhVmJsB7pOgKg0IJwllTeM=' 
WHERE 
  key_id = '6234e62d3d174f185ed435c65d514a3628fcba8d6721fc6d1e4bc47e228a156d' 
  AND (
    token = 'NBflY0srSekWox+VvaB/PqhVmJsB7pOgKg0IJwllTeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021