UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dv0VKQ+osf47PTGTlfUAY4M/Oo7pTQUPQ9Uah6Zcf5k=' 
WHERE 
  key_id = '0164146cb49416d086307b8a77bbcb74b29ecbc0be7eaf414ea547468a2bc3af' 
  AND (
    token = 'dv0VKQ+osf47PTGTlfUAY4M/Oo7pTQUPQ9Uah6Zcf5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038