UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tv340dL3JZJZyJD6jmihnOdwPnA3GGZhIyKK24A1MBs=' 
WHERE 
  key_id = 'ff0979226afba3156eae3c4554ff8f27eefee44a902b73934e1566915e746cdd' 
  AND (
    token = 'Tv340dL3JZJZyJD6jmihnOdwPnA3GGZhIyKK24A1MBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032