UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nVOJ84eZWbVQa8SgWqmHMY+kSp66y2Qtg16f5zwsSLI=' 
WHERE 
  key_id = 'c5d78e000e85802d035f038f7dd7454aaeac9be2d9470ab890ac0b39c22ebbbe' 
  AND (
    token = 'nVOJ84eZWbVQa8SgWqmHMY+kSp66y2Qtg16f5zwsSLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026