UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PmPtGcOnL2Tn6uK9oJrZdiumuYquNZbRhFUYrFaLHcM=' 
WHERE 
  key_id = '6e25df4424beb66f69aadb970eee2d13888e64d7ef358e7960b814555475c3a9' 
  AND (
    token = 'PmPtGcOnL2Tn6uK9oJrZdiumuYquNZbRhFUYrFaLHcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027