UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CAvl2cT+G9NXGiUyMBwK6um7ugWZ1gibrBwiau+2ENw=' 
WHERE 
  key_id = '9e9b9e8604f7e91ab74acde082bc30b3a7dfd42bd30443d2e5cbd77632c3d6e1' 
  AND (
    token = 'CAvl2cT+G9NXGiUyMBwK6um7ugWZ1gibrBwiau+2ENw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034