UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Usp9n/WT3tZDlHnE/8cdo79Aq5GIki3qRt3o/BKhpv8=' 
WHERE 
  key_id = '030d7b0188cc6e888551a125c232b0602d41a5805d466f2d0f18a485f174fadb' 
  AND (
    token = 'Usp9n/WT3tZDlHnE/8cdo79Aq5GIki3qRt3o/BKhpv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046