UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hKLTHAbD/bHFSlFhP2sjn98lyJrAA7lvaz5XkVcV3MU=' 
WHERE 
  key_id = '2c999bea1aca4574925e1de38178c8f699a9840141f86ed3c96ca878f94cf63d' 
  AND (
    token = 'hKLTHAbD/bHFSlFhP2sjn98lyJrAA7lvaz5XkVcV3MU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032