UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KZwNf6iGCP/DoFD0Lx2B+Tx/hKKZD9fS704RqOmQsp0=' 
WHERE 
  key_id = 'e82b79718dfe2c7aa76b8b4d7065d37acf5acd66e10dec52583eb29233ebbc94' 
  AND (
    token = 'KZwNf6iGCP/DoFD0Lx2B+Tx/hKKZD9fS704RqOmQsp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031