UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPS1ana+NsYPd5TWGWUTGOxvU5HGWCHaqIQe/huO2xc=' 
WHERE 
  key_id = 'c30849ee261b719108c5f082b5ac3d7fb3d42e1e03100df45da5c84fb89158b1' 
  AND (
    token = 'lPS1ana+NsYPd5TWGWUTGOxvU5HGWCHaqIQe/huO2xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037