UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'peD9wrpVMGMUK9UI3vgwTH/RHBfg6k3DQukQLDsxsUQ=' 
WHERE 
  key_id = 'd49c0a523c148a9862167356dfd857652fc5d165c75303e31edef614dfbda03f' 
  AND (
    token = 'peD9wrpVMGMUK9UI3vgwTH/RHBfg6k3DQukQLDsxsUQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054