UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qHuPK5e/UDa1ZcZRzZvQ/I5hBkjL6lPuUXYl6Nx8npA=' 
WHERE 
  key_id = '9046d276618d999bf1214a44506705cb7822fe3aa83fdccda51661246e240e2d' 
  AND (
    token = 'qHuPK5e/UDa1ZcZRzZvQ/I5hBkjL6lPuUXYl6Nx8npA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053